package com.tensquare.recruit.controller;

import com.tensquare.recruit.service.RecruitService;
import common.entity.Result;
import common.entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Feng.Wang
 * @Company: Zelin.ShenZhen
 * @Description:
 * @Date: Create in 2019/3/23 16:05
 */
@RestController
@RequestMapping("/recruit")
@CrossOrigin
public class RecruitController {
    @Autowired
    private RecruitService recruitService;

    /**
     * 推荐职位查询
     * @return
     */
    @RequestMapping(value = "/search/recommend",method = RequestMethod.GET)
    public Result findRecommend(){
        return new Result(true, StatusCode.OK,"推荐职位查询成功！",
                recruitService.findTop4ByStateOrderByCreatetimeDesc("2"));
    }

    /**
     * 查询最新职位
     * @return
     */
    @RequestMapping(value = "/search/newlist",method = RequestMethod.GET)
    public Result findBynewlist(){
        return new Result(true, StatusCode.OK,"最新职位列表查询成功！",
                recruitService.findTop12ByStateNotOrderByCreatetimeDesc("0"));
    }
}
